print('程序开始')
# NameError
# NameError: name 'a' is not defined
# print(a)

# TypeError
# TypeError: unsupported operand type(s) for +: 'int' and 'str'
# print(1 + 'a')

# KeyError
# KeyError: 'name'
# dict1 ={}
# print(dict1['name'])

print('程序结束')

# 程序从上到下依次运行,当我们执行到某一行代码出现异常后,会立即终止程序,无法继续执行.

for i in range(2):
    a = 1

print(a)

